{% extends 'layout.html' %}

{% block content %}

        <div class="container">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">添加用户</h3>
          </div>
          <div class="panel-body">
             <!-- 没有写action 提交到当前路径下 -->
             <form method="post" novalidate>
                 <!--必须添加隐藏token,django会自动校验 -->
                 {% csrf_token %}
                 {% for field in form %}
                    <div class="form-group">
                        <label>{{ field.label }}</label>
                        {{ field }}
                        <span style="color: red;">{{ field.errors.0 }}</span>
                    </div>
                 {% endfor %}

              <button type="submit" class="btn btn-primary">提 交</button>
            </form>
          </div>
        </div>

    </div>

{% endblock %}
